import 'package:json_annotation/json_annotation.dart';

part 'cards.g.dart';

@JsonSerializable()
class Cards {
  final int id;
  final String name;
  @JsonKey(unknownEnumValue: CardSign.unknown)
  final CardSign sign;
  final int status;
  @JsonKey(name: 'created_at')
  final int createdAt;
  @JsonKey(name: 'updated_at')
  final int updatedAt;
  Cards({
    required this.id,
    required this.name,
    required this.sign,
    required this.status,
    required this.createdAt,
    required this.updatedAt,
  });

  factory Cards.fromJson(Map<String, dynamic> json) => _$CardsFromJson(json);

  Map<String, dynamic> toJson() => _$CardsToJson(this);
}

@JsonEnum()
enum CardSign {
  /// 睡眠
  @JsonValue('sleep')
  sleep,

  /// 血压
  @JsonValue('bloodPressure')
  bloodPressure,

  /// 心脏健康
  @JsonValue('heartHealth')
  heartHealth,

  /// 情绪健康
  @JsonValue('emotionalHealth')
  emotionalHealth,

  /// 血氧饱和度
  @JsonValue('oxyhemoglobinSaturation')
  oxyhemoglobinSaturation,

  /// 血糖
  @JsonValue('bloodGlucose')
  bloodGlucose,

  /// 体温
  @JsonValue('Temperature')
  temperature,

  /// 健康档案
  @JsonValue('healthFile')
  healthFile,

  @JsonValue('unknown')
  unknown
}
